package org.example.common.feign;//package com.njwx.yq.common.feign;
//
//import com.njwx.yq.common.bean.ResponseBean;
//import com.njwx.yq.common.feign.config.OuterGatewayFeignInterceptor;
//import feign.hystrix.FallbackFactory;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.cloud.openfeign.FeignClient;
//import org.springframework.stereotype.Component;
//import org.springframework.web.bind.annotation.GetMapping;
//import org.springframework.web.bind.annotation.PathVariable;
//
///**
// * Feign Demo 接口.
// *
// * @author dingcan
// * @since 2022-12-10 14:41
// */
//@FeignClient(value = "feign-demo", fallbackFactory = FeignDemo.FallBackFactory.class, configuration = OuterGatewayFeignInterceptor.class)
//public interface FeignDemo {
//
//    @GetMapping("/demo/{id}")
//    ResponseBean<String> demo(@PathVariable("id") Integer id);
//
//    @Component
//    class Fallback implements FeignDemo {
//
//        @Override
//        public ResponseBean<String> demo(Integer id) {
//            return ResponseBean.failed("network fluctuations, it's a fallback.");
//        }
//    }
//
//    @Component
//    @Slf4j
//    class FallBackFactory implements FallbackFactory<Fallback> {
//
//        @Override
//        public Fallback create(Throwable cause) {
//            log.warn("fallback 错误原因:{}", cause.getMessage(), cause);
//            return new Fallback();
//        }
//    }
//
//}